// Package switcherXorm cmd的函数
package switcherXorm

import (
	"log"

	"ginbase/switcher/comm"

	"github.com/gin-gonic/gin"
	"github.com/xormplus/xorm"
)

// Xl Dispatch的返回函数
type Xl map[string]func(*gin.Context) (string, interface{})

// MultiSQL db4web sql接口的struct
type MultiSQL struct {
    Key  string `json:"key"`
    SQL  string `json:"sql"`
    Vals string `json:"vals"`
}

// Dispatch 根据cmd分发到不同的接口函数
func Dispatch(db *xorm.Engine) Xl {
    return Xl{
        "test": func(c *gin.Context) (string, interface{}) {
            id := c.Query("id")
            log.Printf(comm.ConstVar["tokenKey"])
            return "test success", "id=" + id
        },
    }
}
